home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Apple Location Manager / Sources / Utilities.h < prev   
Encoding:
C/C++ Source or Header  |  1998-01-09  |  3.2 KB  |  100 lines  |  [TEXT/CWIE]

  1. /*
  2.      File:        Utilities.h
  3.  
  4.      Contains:    Location Manager SDK Sample Module handy routines
  5.  
  6.      Version:    ALM SDK 2.0
  7.                  Package:    Location Manager SDK 2.0
  8.  
  9.      Copyright:    © 1996-1997 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        Please include the the file and version information (from above) with
  13.                  the problem description.  Developers belonging to one of the Apple
  14.                  developer programs can submit bug reports to:
  15.  
  16.                      devsupport@apple.com
  17.  
  18. */
  19.  
  20. #ifndef        __UTILITIES__
  21. #define        __UTILITIES__
  22.  
  23. // ------------------------------------------------------------------------------------------------- 
  24.  
  25. // MacOS Includes...
  26.  
  27. #include    <Components.h>
  28. #include    <LocationManager.h>
  29. #include    <Processes.h>
  30. #include    <Quickdraw.h>
  31.  
  32. // ------------------------------------------------------------------------------------------------- 
  33.  
  34. // Module-specific defines...
  35.  
  36. #define        kModuleVersion                0
  37.  
  38.     // We didn't actually change the setting format between SDK 1.0 and 2.0, but this was a
  39.     // convenient way to call out the problem; see the discussion at "UseSetting" in Utilities.c...
  40.  
  41. #define        kOldSettingVersion            1        // From SDK 1.0
  42. #define        kSettingVersion                2        // Current settings...
  43.  
  44. // ------------------------------------------------------------------------------------------------- 
  45.  
  46. // Types...
  47.  
  48. typedef struct {
  49.     UInt32            dateCreated;        // Date file created &
  50.     UInt32            dateModified;        // Date file modified == "changed" indicator...
  51.     UInt32            dataForkOffset;        // Relative position of data fork data...
  52.     UInt32            dataForkLen;        // Length of data fork data...
  53.     UInt32            resForkOffset;        // Resource fork data position...
  54.     UInt32            resForkLen;            // Length of resource fork data...
  55. } FileInfoRec, *FileInfoPtr;
  56.  
  57. typedef struct {
  58.     Component        self;                // Reference back to ourselves for closure...
  59.     SInt32            resFile;            // Reference for our open resource fork...
  60.     UInt32            fileCount;            // Number of records below...
  61.     FSSpec            theFiles[kVariableLengthArray];
  62. } Globals, *GlobalsPtr, **GlobalsHandle;
  63.  
  64. typedef struct {
  65.     UInt32            version;            // Version of the setting...
  66.     UInt32            fileCount;            // Number of records below...
  67.     FileInfoRec        fileInfo[kVariableLengthArray];
  68.     // actual file data follows array...
  69. } SettingRec, *SettingPtr, **SettingHandle;
  70.  
  71. // ------------------------------------------------------------------------------------------------- 
  72.  
  73. // Exports...
  74.  
  75. extern OSErr
  76. UseSetting (GlobalsHandle globals, SettingHandle setting, ALMRebootFlags* flags);
  77.     // Make 'setting' the current setting...
  78.  
  79. extern OSErr
  80. ReadSetting (GlobalsHandle globals, SettingHandle setting);
  81.     // Read the system state into setting...
  82.  
  83. extern OSErr
  84. ConfirmFSSpecs (GlobalsHandle globals);
  85.     // Ensure that the FSSpec array in globals conforms to the resource list of files
  86.     // to look for...
  87.  
  88. extern void
  89. InsParamStr (StringPtr matchThis, StringPtr replaceWithThis, StringPtr replaceInThis);
  90.     // Insert 'replaceWithThis' into 'replaceInThis' at the first instance of
  91.     // 'matchThis'...
  92.  
  93. extern OSErr
  94. LaunchApplications (LaunchFlags theFlags);
  95.     // Launch all the applications in the resource in question...
  96.  
  97. // ------------------------------------------------------------------------------------------------- 
  98.  
  99. #endif        // __UTILITIES__
  100.